load("//bazel:fuzz_testing.bzl", "rust_fuzz_test_binary_afl")

package(default_visibility = ["//visibility:private"])

MACRO_DEPENDENCIES = []

CALLSERVICE_FUZZER_DEPENDENCIES = [
    # Keep sorted.
    "//packages/ic-error-types",
    "//rs/config",
    "//rs/crypto/temp_crypto",
    "//rs/crypto/test_utils/crypto_returning_ok",
    "//rs/http_endpoints/nns_delegation_manager",
    "//rs/http_endpoints/public",
    "//rs/interfaces",
    "//rs/interfaces/registry",
    "//rs/interfaces/registry/mocks",
    "//rs/limits",
    "//rs/monitoring/logger",
    "//rs/monitoring/tracing",
    "//rs/protobuf",
    "//rs/registry/keys",
    "//rs/registry/provisional_whitelist",
    "//rs/test_utilities/state",
    "//rs/test_utilities/time",
    "//rs/test_utilities/types",
    "//rs/types/base_types",
    "//rs/types/types",
    "//rs/validator/http_request_arbitrary",
    "@crate_index//:arbitrary",
    "@crate_index//:axum",
    "@crate_index//:bytes",
    "@crate_index//:http-body",
    "@crate_index//:http-body-util",
    "@crate_index//:hyper",
    "@crate_index//:hyper-util",
    "@crate_index//:ic-agent",
    "@crate_index//:libfuzzer-sys",
    "@crate_index//:mockall",
    "@crate_index//:prost",
    "@crate_index//:tokio",
    "@crate_index//:tokio-util",
    "@crate_index//:tower",
    "@crate_index//:tower-test",
    "@crate_index//:tracing-subscriber",
]

# required to compile tests/common
DEV_DEPENDENCIES = [
    # Keep sorted.
    "//rs/certification/test-utils",
    "//rs/crypto/tls_interfaces",
    "//rs/crypto/tls_interfaces/mocks",
    "//rs/crypto/tree_hash",
    "//rs/interfaces/mocks",
    "//rs/interfaces/state_manager",
    "//rs/interfaces/state_manager/mocks",
    "//rs/monitoring/metrics",
    "//rs/monitoring/pprof",
    "//rs/registry/routing_table",
    "//rs/registry/subnet_type",
    "//rs/replicated_state",
    "@crate_index//:reqwest",
    "@crate_index//:serde_cbor",
]

rust_fuzz_test_binary_afl(
    name = "execute_call_service_afl",
    testonly = True,
    srcs = [
        "fuzz_targets/execute_call_service.rs",
        "//rs/http_endpoints/public:tests/common/mod.rs",
    ],
    crate_root = "fuzz_targets/execute_call_service.rs",
    proc_macro_deps = MACRO_DEPENDENCIES,
    deps = CALLSERVICE_FUZZER_DEPENDENCIES + DEV_DEPENDENCIES,
)
